<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function fun1() {
            var data = [];
            return {
                add: function (obj) {
                    data.push(obj);
                },
                remove: function () {
                    data.shift() //删除数组第一个元素
                },
                getData: function () {
                    return data;
                }
            }
        }
        fun1()
        var fn = fun1();
        fn.add(7);
        fn.add(4);
        fn.add(8); fn.add(14);
        fn.add(2);
        fn.add(3); fn.add(78);
        fn.add(1);
        fn.remove()

        console.log(fn.getData());


    //为data添加四个数据
    //2.查看数据
    //3.删除数据
    //4.再次查看数据
    </script>
</body>

</html>